//
//  HYUserCell.m
//  HaiYue
//
//  Created by skyline on 2018/6/14.
//  Copyright © 2018年 skyline. All rights reserved.
//

#import "HYUserCell.h"
@interface  HYUserCell ()
@end
@implementation HYUserCell
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self)
    {
        self.selectionStyle = UITableViewCellSeparatorStyleNone;
        self.rightArrowIMG.hidden = YES;
    }
    return self;
}
- (HYView *)line
{
    if (!_line)
    {
        _line = [[HYView alloc] initWithColor:CELL_LINE_COLOR];
        [self addSubview:_line];
        [_line mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self);
            make.right.equalTo(self);
            make.bottom.equalTo(self);
            make.height.mas_equalTo(0.5);
        }];
    }
    return _line;
}
- (HYImageView *)rightArrowIMG
{
    if (!_rightArrowIMG)
    {
        _rightArrowIMG = [[HYImageView alloc]initWithImage:[UIImage imageNamed:@"rightArrow_select"]];
        _rightArrowIMG.bounds = CGRectMake(0, 0, HYCellRightArrowWidth, HYCellRightArrowHeight);
        [self addSubview:_rightArrowIMG];
        [_rightArrowIMG mas_makeConstraints:^(MASConstraintMaker *make) {
            make.right.equalTo(self).with.offset(- GAP / 2.0);
            make.centerY.equalTo(self);
            make.size.mas_equalTo(self.rightArrowIMG.bounds.size);
        }];
    }
    return _rightArrowIMG;
}

- (HYLabel *)contentLBL
{
    if (!_contentLBL)
    {
        _contentLBL = [[HYLabel alloc] initWithText:@"" textColor:TEXT_GRAY_COLOR textFont:[UIFont systemFontOfSize:ContentFont]];
        [self addSubview:_contentLBL];
        [_contentLBL mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerY.equalTo(self);
            if (self.rightArrowIMG.hidden == NO)
                make.right.equalTo(self.rightArrowIMG.mas_left).with.offset(-GAP);
            else
                make.right.equalTo(self).with.offset(-GAP);
        }];
    }
    return _contentLBL;
}
- (HYLabel *)titleLBL
{
    if (!_titleLBL)
    {
        _titleLBL = [[HYLabel alloc] initWithText:@"" textColor:TEXT_GRAY_COLOR textFont:[UIFont systemFontOfSize:ContentFont]];
        [self addSubview:_titleLBL];
        [_titleLBL mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self).with.offset(GAP / 2.0);
            make.centerY.equalTo(self);
        }];
    }
    return _titleLBL;
}
- (HYImageView *)img
{
    if (!_img)
    {
        _img = [[HYImageView alloc] initWithImage:[UIImage imageNamed:@"default_gameicon"] cornerRadius:(44 - 10) / 2.0];
        _img.layer.borderWidth = 1;
        _img.layer.borderColor = RGBA(130, 240, 240, 1).CGColor;
        [self addSubview:_img];
        [_img mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerY.equalTo(self);
            make.size.mas_offset(self.img.bounds.size);
            if (self.rightArrowIMG.hidden == NO)
                make.right.equalTo(self.rightArrowIMG.mas_left).with.offset(- GAP);
            else
                make.right.equalTo(self).with.offset(-GAP);
        }];
    }
    return _img;
}

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];
    
    // Configure the view for the selected state
}

@end
